package com.jason.kotlin.gank.ui

import com.jason.kotlin.gank.ui.fragments.RollNewsListFragment
import com.jason.kotlin.gank.viewmodel.RollNewsViewModel
import com.jason.library.common.base.BaseStateTabActivity
import com.jason.library.common.ext.observe

/**
 * @description: RollNewsTabActivity
 *
 * @author ChenBaoyang
 * @date 4/29/21 10:31
 */
class RollNewsTabActivity :BaseStateTabActivity<RollNewsViewModel>() {

    override fun bindLiveData() {
        observe(viewModel!!.dataNewsType) {
            for (i in it!!) {
                pagerAdapter.addFragment(RollNewsListFragment.newInstance(i.typeId), i.typeName)
            }
            pagerAdapter.notifyDataSetChanged()
        }
    }

    override fun onDataInit() {
        viewModel!!.loadNewsTypes()
    }
}